A conventional computer graphics system can display objects on a display. The display includes a plurality of display elements, known as pixels, typically arranged in a grid. In order to display objects, the conventional computer graphics system typically breaks each object into a plurality of polygons. A conventional system then typically renders the polygons in a particular order. For a three-dimensional scene, the polygons are generally rendered from back to front as measured from the viewing plane of the display. Similarly, a two-dimensional scene can be displayed where polygons are rendered based on their layer. Deeper layers are occluded by shallower layers.
When rendering each polygon, the conventional system often renders diagonal lines or polygons which have edges that are not perfectly horizontal or vertical. When a diagonal line is rendered, pixels not directly above or next to each other are used to render the line. However, each pixel is not a point. Instead, each pixel has physical dimensions. For example, consider each pixel to be a square. As a result, a diagonal line will not appear smooth. Instead, the edges of the line will appear jagged, similar to a staircase. This effect is known as aliasing. Aliasing may appear for similar reasons at edges of a polygon. In order to reduce this effect, conventional systems perform antialiasing. Antialiasing helps reduce the effect that the physical dimension of the pixels has on the appearance of objects being displayed.
Several conventional mechanisms are used to perform antialiasing. Each mechanism has its drawbacks. One conventional mechanism determines the color for a pixel across which an edge lies by blending the colors of polygons existing at a pixel. The blending value for each polygon is used to determine how much the polygon will contribute to the color of a particular pixel. The polygon occupies only a fraction of the area for a pixel on which the edge of the polygon lies. Because the polygon contributes only a fraction of the color for such a pixel, the color of the polygon is blended with the remaining colors for the pixel. As a result, staircasing is reduced. However, some of the polygons at a pixel or the background may be obstructed. These polygons or the background still have a blending value which allows them to contribute to the color of a pixel. As a result, the color of the obstructed polygon is displayed to a user. This effect is known as edge bleeding and is undesirable.
A second conventional mechanism for antialiasing is to render a polygon multiple times. Each time the polygon is rendered, the polygon is shifted slightly. Similarly, a polygon can be inflated slightly. The edges of the inflated polygon are translucent. As a result, the edges are blurred and staircasing is reduced. However, because the polygon is shifted each time it is rendered, the entire polygon appears blurred. In addition, bleed through can occur at the edges.
A third conventional mechanism for antialiasing is known as supersamnpling. Each pixel is considered to be an M×N matrix of subpixels. Data for each polygon is evaluated at each subpixel. Finally, data for each subpixel in a pixel is combined to provide the data for each pixel in the polygon. As a result, aliasing is reduced. However, in order to perform supersampling, much more data is processed for each pixel. For example, a pixel broken into M×N subpixels will require M*N the amount of processing as a pixel which is not supersampled. Consequently, processing is slowed. Furthermore, supersampling is typically performed for a portion of the display, called a tile, or the entire display at a time. Each pixel in the tile or display has M×N subpixels. Thus, the system requires enough memory to retain data for M×N subpixels for each pixel in a tile. Therefore, a large amount of memory is required. If only a tile is rendered, then it must be ensured that there are not artifacts at the seam between tiles. Thus, processing is again slowed.
A fourth conventional mechanism for antialiasing uses an accumulation buffer (“A-buffer”) and is known as an A-buffer technique. Data for each pixel in each polygon is processed. During processing, a mask is provided for each pixel in each polygon. The mask indicates the portion of the pixel covered by the polygon. A linked list is then provided for each pixel. The linked list links polygons that are associated with each pixel to the pixel. To link polygons, the linked list typically holds a mask, a color value, and other data relating to each polygon's potential contribution to the display of the pixel. After the entire scene has been stored in the A-buffer, the linked list is then traversed in order to accumulate and render data from the polygons associated with each pixel. Aliasing is thereby reduced. However, the A-buffer technique also has its drawbacks. Two passes are made through the data in order to render objects to the display. The first pass is to provide the masks for each polygon and to associate the polygons with particular pixels. The second pass utilizes the data stored for each pixel to determine how data for each pixel is to be displayed. Thus, this mechanism is time consuming. The linked list must also be managed by the computer graphics system, making the A-buffer technique more difficult to implement. Typically both an A-buffer and a frame buffer are used in rendering the scene. Therefore, the A-buffer technique also requires additional memory.
A fifth technique for antialiasing finds the edges of each polygon being rendered. Antialiased lines or lines having some transparency are then drawn over the edges. This may give the appearance of the polygon edge being smooth. To avoid edge bleeding, the application must indicate “silhouette” edges, which are time consuming to calculate.
Accordingly, what is needed is a system and method for more efficiently providing antialiasing. The present invention addresses such a need.